package com.dfrz.ch02;/*
 * @创建者：黄苟苟
 * @创建时间：2021/6/7   20:17
 * @Description描述
 **/

import java.util.Scanner;

public class TestCycle {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入圆的半径");
        try {//抛出异常(输入非数字
            // )
            double r = sc.nextDouble();
            if (r>0) {
                double area = Math.PI * r * r;
                double round = Math.PI * r * 2;
                System.out.println("圆的周长为：" + round);
                System.out.println("圆的面积为: " + area);
            }else{
                System.out.println("请输入正确的半径");
            }
        } catch (Exception e) {

            System.out.println("请输入数字");
        }
    }
}
